package com.example.javaproject;

import com.test.classLoader.MyClassLoader;

public class ClinitTest {
    public static void main(String[] args) {
/*        Const[] array = new Const[3];
        System.out.println(array.getClass().getClassLoader());
        System.out.println(Const.class.getClassLoader());
        *//*for (Const each : array) {
            each = new Const();
        }*//*
        String[] array2 = new String[2];

        System.out.println(array2.getClass().getClassLoader());
        System.out.println(String.class.getClassLoader());*/


        System.out.println("--------------------");
        MyClassLoader loader = new MyClassLoader("CustomizeLoader");
        try {
            Class<?> aClass = loader.loadClass("com.example.javaproject.Child");
            Object o = aClass.newInstance();
            System.out.println(o.getClass().getClassLoader().toString());
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
